package com.helloUIBinder.client;

import com.helloUIBinder.client.widgets.BlogAnnotationWidget;
import com.helloUIBinder.model.BlogPost;

import java.util.ArrayList;
import java.util.List;

public class Utils {
    public static List<BlogAnnotationWidget> getBlogPostWidgetsFromEntities(List<BlogPost> list){
        List<BlogAnnotationWidget> result = new ArrayList<BlogAnnotationWidget>();
        for(BlogPost currentPost: list){
            BlogAnnotationWidget blogAnnotationWidget = new BlogAnnotationWidget();
            blogAnnotationWidget.setBlogPostText(currentPost.getText());
            blogAnnotationWidget.setBlogPostOwnerLink(currentPost.getOwner());
            blogAnnotationWidget.setBlogPostThemeLink(currentPost.getTheme());
            result.add(blogAnnotationWidget);
        }
        return result;
    }
}
